home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kspell2 / dictionary.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  3.1 KB  |  111 lines

  1. // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
  2. /*
  3.  * dictionary.h
  4.  *
  5.  * Copyright (C)  2004  Zack Rusin <zack@kde.org>
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20.  * 02110-1301  USA
  21.  */
  22. #ifndef KSPELL_DICTIONARY_H
  23. #define KSPELL_DICTIONARY_H
  24.  
  25. #include <qstringlist.h>
  26. #include <qstring.h>
  27.  
  28. namespace KSpell2
  29. {
  30.     /**
  31.      * Class is returned by from Broker. It acts
  32.      * as the actual spellchecker.
  33.      *
  34.      * @author Zack Rusin <zack@kde.org>
  35.      * @short class used for actuall spell checking
  36.      */
  37.     class Dictionary
  38.     {
  39.     public:
  40.         virtual ~Dictionary() {}
  41.  
  42.         /**
  43.          * Checks the given word.
  44.          * @return false if the word is misspelled. true otherwise
  45.          */
  46.         virtual bool check( const QString& word ) =0;
  47.  
  48.         /**
  49.          * Fetches suggestions for the word.
  50.          *
  51.          * @return list of all suggestions for the word
  52.          */
  53.         virtual QStringList suggest( const QString& word ) =0;
  54.  
  55.         /**
  56.          * Checks the word and fetches suggestions for it.
  57.          */
  58.         virtual bool checkAndSuggest( const QString& word,
  59.                                       QStringList& suggestions ) =0;
  60.  
  61.         /**
  62.          * Stores user defined good replacement for the bad word.
  63.          * @returns true on success
  64.          */
  65.         virtual bool storeReplacement( const QString& bad,
  66.                                        const QString& good ) =0;
  67.  
  68.         /**
  69.          * Adds word to the list of of personal words.
  70.          * @return true on success
  71.          */
  72.         virtual bool addToPersonal( const QString& word ) =0;
  73.  
  74.         /**
  75.          * Adds word to the words recognizable in the current session.
  76.          * @return true on success
  77.          */
  78.         virtual bool addToSession( const QString& word ) =0;
  79.  
  80.         /**
  81.          * Returns language supported by this dictionary.
  82.          */
  83.         QString language() const
  84.         {
  85.             return m_language;
  86.         }
  87.  
  88.         /**
  89.          * Returns true if this dictionary was constructed from
  90.          * default Settings values
  91.          */
  92.         bool isDefault() const
  93.         {
  94.             return m_default;
  95.         }
  96.  
  97.     protected:
  98.         Dictionary( const QString& lang, bool def = false )
  99.             : m_language( lang ), m_default( def ) {}
  100.     protected:
  101.         friend class Broker;
  102.         QString m_language;
  103.         bool    m_default;
  104.     private:
  105.         class Private;
  106.         Private *d;
  107.     };
  108. }
  109.  
  110. #endif
  111.